﻿// Sigma ASC 105 LED Panel Control Library - http://www.codeplex.com/SigmaASC105lib/
// Copyright (c) Michal A. Valasek - Altairis, 2008 - http://www.altairis.cz/
// This code is licensed under terms of the Microsoft Public License (Ms-PL).

namespace Altairis.LedPanelControl {

    internal static class Common {
        // Beginning and end of communication 
        public static readonly byte[] MessageLeadIn = { 0x00, 0xFF, 0xFF, 0x00, 0x0B, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0xFF, 0x01 };
        public static readonly byte[] MessageLeadOut = { 0xFF, 0xFF, 0x00 };
        public static readonly byte[] SetTimeLeadIn = { 0x00, 0xFF, 0xFF, 0x00, 0x0B, 0x00, 0xFF, 0x08, 0x01, 0x00 };
        public static readonly byte[] SetTimeLeadOut = { 0xFF, 0x00 };

        // Special sequences
        public static readonly byte[] SetAlarmOn = { 0x00, 0xFF, 0xFF, 0x00, 0x0B, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0xFF, 0x05, 0x01, 0xFF, 0x00 };
        public static readonly byte[] SetAlarmOff = { 0x00, 0xFF, 0xFF, 0x00, 0x0B, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0xFF, 0x05, 0x00, 0xFF, 0x00 };
        public static readonly byte[] SelfTest = { 0x00, 0xFF, 0xFF, 0x00, 0x0B, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0xFF, 0x0A, 0x01, 0xFF, 0x00 };

        // New line character (the sign does not use CR/LF)
        public const byte NewLine = 0xFF;

        // Prefix character used for control codes
        public const byte ControlPrefix = 0xEF;
    }

    public enum Color : byte {
        Default = Red,
        Previous = 0,
        Red = 0xB0,
        BrightRed = 0xB1,
        Orange = 0xB2,
        BrightOrange = 0xB3,
        Yellow = 0xB4,
        BrightYellow = 0xB5,
        Green = 0xB6,
        BrightGreen = 0xB7,
        LayerMix = 0xB8,
        BrightLayerMix = 0xB9,
        VerticalMix = 0xBA,
        SawtoothMix = 0xBB,
        GreenOnRed = 0xBC,
        RedOnGreen = 0xBD,
        OrangeOnRed = 0xBE,
        YellowOnGreen = 0xBF,
    }

    public enum Font : byte {
        Default = Fixed06x07,
        Previous = 0,
        Fixed06x05 = 0xA0,
        Fixed11x05 = 0xA1,
        Fixed06x07 = 0xA2,
        Fixed11x07 = 0xA3,
        Fixed09x07 = 0xA4,
        Fixed17x07 = 0xA5,
        Proportional = 0xA6,
    }

    public enum Glyph : byte {
        Sun = 0x60,
        Cloud = 0x61,
        Rain = 0x62,
        Clock = 0x63,
        Phone = 0x64,
        Glasses = 0x65,
        Faucet = 0x66,
        Rocket = 0x67,
        Alien = 0x68,
        Key = 0x69,
        Sweater = 0x6A,
        Helicopter = 0x6B,
        Car = 0x6C,
        Tank = 0x6D,
        House = 0x6E,
        Teapot = 0x6F,
        Trees = 0x70,
        Duck = 0x71,
        Motorcycle = 0x72,
        Bicycle = 0x73,
        Crown = 0x74,
        Heart = 0x75,
        ArrowRight = 0x76,
        ArrowLeft = 0x77,
        ArrowLeftDown = 0x78,
        ArrowLeftUp = 0x79,
        Cup = 0x7A,
        Chair = 0x7B,
        Boot = 0x7C,
        MartiniGlass = 0x7D,
    }

    public enum Logo : byte {
        UserDefined1 = 0xD0,
        UserDefined2 = 0xD1,
        UserDefined3 = 0xD2,
        UserDefined4 = 0xD3,
        UserDefined5 = 0xD4,
        UserDefined6 = 0xD5,
        UserDefined7 = 0xD6,
        UserDefined8 = 0xD7,
        City = 0xD8,
        Cars = 0xD9,
        TeaSet = 0xDA,
        Telephone = 0xDB,
        Nature = 0xDC,
        Ship = 0xDD,
        Swimmers = 0xDE,
        Cat = 0xDF,
        CartoonMerryXMass = 0x90,
        CartoonHappyNewYear = 0x91,
        Cartoon4thJuly = 0x92,
        CartoonHappyEaster = 0x93,
        CartoonHappyHalloween = 0x94,
        CartoonDontDrinkAndDrive = 0x95,
        CartoonNoSmoking = 0x96,
        CartoonWelcome = 0x97,
    }

    public enum SpecialFunction : byte {
        CurrentTime = 0x80,
        CurrentDate = 0x81,
        Beep1 = 0xE0,
        Beep2 = 0xE1,
        Beep3 = 0xE2,
        Delay02Seconds = 0xC8,
        Delay03Seconds = 0xC9,
        Delay04Seconds = 0xCA,
        Delay06Seconds = 0xCB,
        Delay10Seconds = 0xCC,
        Delay20Seconds = 0xCD,
        Delay30Seconds = 0xCE,
        Delay60Seconds = 0xCF,
    }

    public enum AnimationSpeed : byte {
        Previous = 0,
        Default = Speed4,
        Speed1 = 0xC0,
        Speed2 = 0xC1,
        Speed3 = 0xC2,
        Speed4 = 0xC3,
        Speed5 = 0xC4,
        Speed6 = 0xC5,
        Speed7 = 0xC6,
        Speed8 = 0xC7,
    }

    public enum AnimationType : byte {
        Default = Auto,
        Previous = 0,
        Cyclic = 0x01,
        Immediate = 0x02,
        OpenFromRight = 0x03,
        OpenFromLeft = 0x04,
        OpenFromCenter = 0x05,
        OpenFromSides = 0x06,
        CoverFromCenter = 0x07,
        CoverFromRight = 0x08,
        CoverFromLeft = 0x09,
        CoverFromSides = 0x0A,
        ScrollUp = 0x0B,
        ScrollDown = 0x0C,
        InterlaceToCenter = 0x0D,
        InterlaceCover = 0x0E,
        CoverUp = 0x0F,
        CoverDown = 0x10,
        ScanLine = 0x11,
        Explode = 0x12,
        PacMan = 0x13,
        FallAndStack = 0x14,
        Shoot = 0x15,
        Flash = 0x16,
        Random = 0x17,
        SlideIn = 0x18,
        Auto = 0x19,
    }

}
